/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.leeassamite.ocr;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author leeass
 */
public class IWord {
    private char word;
    private int[][] bitmap;
    private List<Integer> listC;
    private List<Integer> listD;
    private int intE;
    private int intF;
    public char getWord()
    {
        return this.word;
    }

    public void setWord(char A_0)
    {
        this.word = A_0;
    }
    public int getWidth()
    {
        return this.bitmap.length;
    }
    public int d()
    {
        return (this.bitmap[0]).length;
    }
    public List<Integer> getListC()
    {
        return this.listC;
    }
    public void setListC(List<Integer> A_0)
    {
        this.listC = A_0;
    }
    public List<Integer> setListD()
    {
        return this.listD;
    }
    public void getListD(List<Integer> A_0)
    {
        this.listD = A_0;
    }
    public int getIntE()
    {
        return this.intE;
    }
    public void setIntE(int A_0)
    {
        this.intE = A_0;
    }
    public int getIntF()
    {
        return this.intF;
    }
    public IWord(char A_0, int[][] dotArray)
    {
        this.init(dotArray);
        this.word = A_0;
    }
    public IWord(int[][] dotArray)
    {
        this.init(dotArray);
    }
    private void init(int[][] dotArray)
    {
        this.bitmap = dotArray;
        this.listD = new ArrayList<Integer>();
        this.listD = this.processBitmap2(dotArray);
        this.listC = new ArrayList<Integer>();
        this.listC = this.processBitmap(dotArray);
    }


    private List<Integer> processBitmap(int[][] A_0)
    {
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < A_0[0].length; i++)
        {
            list.add(0);
            for (int j = 0; j < A_0.length; j++)
            {
                int index = i;
                int value = list.get(index)+ A_0[j][i] * (int)Math.pow(2.0, (double)(A_0.length - 1 - j));
                list.remove(index);
                list.add(index, value);
                if (A_0[j][i] == 1)
                {
                    // 点正确，计数器加1
                    this.intF++;
                }
            }
        }
        return list;
    }


    private List<Integer> processBitmap2(int[][] A_0)
    {
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < A_0.length; i++)
        {
            list.add(0);
            for (int j = 0; j < A_0[0].length; j++)
            {
                List<Integer> list2;
                int index = i;
                int value = list.get(index) + A_0[i][j] * (int)Math.pow(2.0, (double)(A_0[0].length - 1 - j));
                list.remove(index);
                list.add(index, value);
            }
        }
        return list;
    }
}
